import request from '@/utils/request'
/**
 * 封装获取部门信息的请求
 */
export const getDepartments = () => {
  return request({
    url: '/api/company/department',
    method: 'get'
  })
}
/**
 * 封装添加部门信息的请求
 */
export const addDepartments = (data) => {
  return request({
    url: '/api/company/department',
    method: 'POST',
    data
  })
}
/**
 *  /company/department/{id}
 * 根据ID查询部门详情
 * @param {*} id 部门id
 * @returns
 */
export const lookDepartments = (id) => {
  return request({
    url: `/api/company/department/${id}`,
    method: 'GET'
  })
}
/**
 * 封装根据ID修改部门详情
 */
export const editDepartments = (data) => {
  return request({
    url: `/api/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}
/** 通过id删除部门
 * {id} id 当前点击的操作按钮 所在的项的id
 */
export const delDepartments = (id) => {
  return request({
    url: `/api/company/department/${id}`,
    method: 'delete'
  })
}
